<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" session="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<title>引导页</title>

<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/plugins/boxgrid/css/default.css" />

		
<!--必要样式-->

<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/plugins/boxgrid/css/component.css?date=1" />
<script src="${pageContext.request.contextPath}/static/js/common.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/plugins/boxgrid/js/modernizr.custom.js"></script>
<script src="${pageContext.request.contextPath}/static/plugins/boxgrid/js/Chart.js"></script>
<style>
		.top1{
			width: 60%;
			position: absolute;
			top: 5%;
			left: 20%;
		}
		.top2{
			position: absolute;
			top: 35%;
		}
		.divcan{
		    margin: 0px 0 0 9%;
			position: relative;
		    height: 138px;
		}
</style>
</head>

<body style="background: url(${pageContext.request.contextPath}/static/plugins/boxgrid/image/beijing.png);background-repeat: no-repeat;">

<div class="top1">
		<div class="divcan">
			<div style="float:left"><canvas id="canvas" height="138" width="138"></canvas></div>
			<div style="float:left"><canvas id="canvas2" height="138" width="138"></canvas></div>
			<div style="float:left"><canvas id="canvas3" height="138" width="138"></canvas></div>
			<div style="float:left"><canvas id="canvas4" height="138" width="138"></canvas></div>
			<div style="float:left"><canvas id="canvas5" height="138" width="138"></canvas></div>
		</div>
</div>
<div class="container top2">	

	
	
	
	<div class="main">

		<ul id="rb-grid" class="rb-grid clearfix">
			<c:forEach items="${homemenus}" var="sysmenu" varStatus="status">
				<c:if test="${status.index%9==1 || status.index%9==3 || status.index%9==8}">
					<li class="rb-span-2" onclick="towhere('${pageContext.request.contextPath}${sysmenu.mUrl}','${sysmenu.sid}')">
						<span><img src="${pageContext.request.contextPath}/static/plugins/boxgrid/image/${sysmenu.picName}" alt=""></span><span class="rb-temp .rb-grid-span2">${sysmenu.mName}</span>
					</li>
				</c:if>
				<c:if test="${status.index%9!=1 && status.index%9!=3 && status.index%9!=8}">
					<li class="" onclick="towhere('${pageContext.request.contextPath}${sysmenu.mUrl}','${sysmenu.sid}')">
						<span><img src="${pageContext.request.contextPath}/static/plugins/boxgrid/image/${sysmenu.picName}" alt=""></span><span class="rb-temp rb-grid-span">${sysmenu.mName}</span>
					</li>
				</c:if>
			</c:forEach>
			
		</ul>
		
	</div>
</div><!-- /container -->

<script type="text/javascript" src="${pageContext.request.contextPath}/static/plugins/boxgrid/js/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/plugins/boxgrid/js/jquery.fittext.js"></script>

<script type="text/javascript">

	var data = ${dataList};
	switch ('${userRole}') {
	case '1':
	case '2':	
		var userallnum = data[2].COUNTNUM;
		var usernum = data[2].A;
		var albumallnum = data[7].COUNTNUM;//发帖
		var albumnum = data[7].A;
		var commentallnum = data[8].COUNTNUM;//评论
		var commentnum = data[8].A;
		var likeallnum = data[9].COUNTNUM;//点赞
		var likenum = data[9].A;
		var openlogallnum = data[13].COUNTNUM;//开门记录
		var openlognum = data[13].A;
		
		break;
	case '3':
	case '4':
		var userallnum = data[1].COUNTNUM;
		var usernum = data[1].A;
		var albumallnum = data[6].COUNTNUM;//发帖
		var albumnum = data[6].A;
		var commentallnum = data[7].COUNTNUM;//评论
		var commentnum = data[7].A;
		var likeallnum = data[8].COUNTNUM;//点赞
		var likenum = data[8].A;
		var openlogallnum = data[12].COUNTNUM;//开门记录
		var openlognum = data[12].A;	
		break;
	case '5':
	case '6':
		var userallnum = data[0].COUNTNUM;
		var usernum = data[0].A;
		var albumallnum = data[5].COUNTNUM;//发帖
		var albumnum = data[5].A;
		var commentallnum = data[6].COUNTNUM;//评论
		var commentnum = data[6].A;
		var likeallnum = data[7].COUNTNUM;//点赞
		var likenum = data[7].A;
		var openlogallnum = data[11].COUNTNUM;//开门记录
		var openlognum = data[11].A;	
		break;
	default:
		var userallnum = 1;
		var usernum = 0;
		var albumallnum = 1;//发帖
		var albumnum = 0;
		var commentallnum = 1;//评论
		var commentnum = 0;
		var likeallnum = 1;//点赞
		var likenum = 0;
		var openlogallnum = 1;//开门记录
		var openlognum = 1;	
	break;
		break;
	}
	
	var pieData = [
				{
					value: usernum,
					color:"#3fa8ff"
				},
				{
					value : userallnum,
					color : "#2380ce"
				}
			
			];
		var pieData2 = [
				{
					value: commentnum,
					color:"#ff9900"
				},
				{
					value : commentallnum,
					color : "#ba6f00"
				}
			
			];
		var pieData3 = [
				{
					value: albumnum,
					color:"#0f7cd9"
				},
				{
					value : albumallnum,
					color : "#1250b0"
				}
			
			];
		var pieData4 = [
				{
					value: openlognum,
					color:"#f5624d"
				},
				{
					value : openlogallnum,
					color : "#ca301a"
				}
			
			];
		var pieData5 = [
				{
					value: likenum,
					color:"#21b3ec"
				},
				{
					value : likeallnum,
					color : "#1b67a6"
				}
			
			];
		
	new Chart(document.getElementById("canvas").getContext("2d")).Pie(pieData);
	new Chart(document.getElementById("canvas2").getContext("2d")).Pie(pieData2);
	new Chart(document.getElementById("canvas3").getContext("2d")).Pie(pieData3);
	new Chart(document.getElementById("canvas4").getContext("2d")).Pie(pieData4);
	new Chart(document.getElementById("canvas5").getContext("2d")).Pie(pieData5);

	function towhere(url,id){
		if(url==""){
			post('${pageContext.request.contextPath}/admin/defaultIndex.action', {mpid :id});
		}else{
			post(url,{mpid:id});
		}
		
	};
</script>

</body>
</html>
